/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lcarou
 */
@Entity
@Table(name = "legCONTRIBUCION_ZONA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LegCONTRIBUCIONZONA.findAll", query = "SELECT l FROM LegCONTRIBUCIONZONA l"),
    @NamedQuery(name = "LegCONTRIBUCIONZONA.findByZona", query = "SELECT l FROM LegCONTRIBUCIONZONA l WHERE l.zona = :zona"),
    @NamedQuery(name = "LegCONTRIBUCIONZONA.findByDescripcion", query = "SELECT l FROM LegCONTRIBUCIONZONA l WHERE l.descripcion = :descripcion"),
    @NamedQuery(name = "LegCONTRIBUCIONZONA.findByPorcentajeReduccion", query = "SELECT l FROM LegCONTRIBUCIONZONA l WHERE l.porcentajeReduccion = :porcentajeReduccion")})
public class LegCONTRIBUCIONZONA implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "Zona")
    private String zona;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "Descripcion")
    private String descripcion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "PorcentajeReduccion")
    private BigDecimal porcentajeReduccion;
    @OneToMany(mappedBy = "zonaContribucion")
    private Collection<LegLEGAJO> legLEGAJOCollection;

    public LegCONTRIBUCIONZONA() {
    }

    public LegCONTRIBUCIONZONA(String zona) {
        this.zona = zona;
    }

    public LegCONTRIBUCIONZONA(String zona, String descripcion) {
        this.zona = zona;
        this.descripcion = descripcion;
    }

    public String getZona() {
        return zona;
    }

    public void setZona(String zona) {
        this.zona = zona;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public BigDecimal getPorcentajeReduccion() {
        return porcentajeReduccion;
    }

    public void setPorcentajeReduccion(BigDecimal porcentajeReduccion) {
        this.porcentajeReduccion = porcentajeReduccion;
    }

    @XmlTransient
    public Collection<LegLEGAJO> getLegLEGAJOCollection() {
        return legLEGAJOCollection;
    }

    public void setLegLEGAJOCollection(Collection<LegLEGAJO> legLEGAJOCollection) {
        this.legLEGAJOCollection = legLEGAJOCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (zona != null ? zona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LegCONTRIBUCIONZONA)) {
            return false;
        }
        LegCONTRIBUCIONZONA other = (LegCONTRIBUCIONZONA) object;
        if ((this.zona == null && other.zona != null) || (this.zona != null && !this.zona.equals(other.zona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.LegCONTRIBUCIONZONA[ zona=" + zona + " ]";
    }
    
}
